package org.wishwork.api.express;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wishwork.api.express.query.ExpressQueryApi;
import org.wishwork.api.express.query.ExpressQueryRequest;
import org.wishwork.api.express.query.response.ExpressQueryResponse;
import org.wishwork.api.express.register.ExpressRegisterApi;
import org.wishwork.api.express.register.ExpressRegisterRequest;
import org.wishwork.api.express.register.ExpressRegisterResponse;
import org.wishwork.api.express.send.ExpressSendApi;
import org.wishwork.api.express.send.ExpressSendRequest;
import org.wishwork.api.express.send.ExpressSendResponse;
import org.wishwork.context.Context;

import java.util.List;

/**
 * @description: 物流API
 * @author: WangYX
 * @create: 2022-04-13 09:16
 * @Version: 1.0.0
 **/
public class ExpressApi {

    private static final Logger log = LoggerFactory.getLogger(ExpressApi.class);

    private Context context;

    private final ExpressQueryApi expressQueryApi;
    private final ExpressRegisterApi expressRegisterApi;
    private final ExpressSendApi expressSendApi;

    public ExpressApi(Context context) {
        this.context = context;
        this.expressQueryApi = new ExpressQueryApi(context);
        this.expressRegisterApi = new ExpressRegisterApi(context);
        this.expressSendApi = new ExpressSendApi(context);
    }

    /**
     * 发货信息查询
     *
     * @param expressQueryRequest
     * @return
     * @throws Exception
     */
    public List<ExpressQueryResponse> query(ExpressQueryRequest expressQueryRequest) throws Exception {
        return this.expressQueryApi.business(expressQueryRequest);
    }

    /**
     * 批量快递登记
     *
     * @param expressRegisterRequests
     * @return
     * @throws Exception
     */
    public ExpressRegisterResponse register(List<ExpressRegisterRequest> expressRegisterRequests) throws Exception {
        return this.expressRegisterApi.business(expressRegisterRequests);
    }


    /**
     * 称重并发货
     *
     * @param expressSendRequests
     * @return
     * @throws Exception
     */
    public List<ExpressSendResponse> send(List<ExpressSendRequest> expressSendRequests) throws Exception {
        return this.expressSendApi.business(expressSendRequests);
    }

}
